
/**
 * 将tree-nodes 转换成 Cascader-nodes对象
 * 是数组对象，这里有个坑，children,loading都是异步的标志
 */
export const treeToCascader = tree => {
	let nodes = []
	if(tree != null && tree.length > 0){
		for(let i = 0; i < tree.length; i++){
			let cascader = {}
			cascader.value = tree[i].id;
			cascader.label = tree[i].title;
			if(tree[i].parent){
				cascader.children = [];
				cascader.loading = false;
			}
			nodes.push(cascader)
		}
	}
	return nodes
}